/************************************************************************/
/* Game                                                                 */
/************************************************************************/
#include "Game/Game Objects/Towers/ShyguyTower.h"

namespace TD_Game {


	/************************************************************************/
	/* Shyguy tower definitions                                             */
	/************************************************************************/

	const int ShyguyTower::shootingInterval[NUMBER_OF_LEVELS] =				{350, 300, 250, 250};
	const unsigned int ShyguyTower::towerRadius[NUMBER_OF_LEVELS] =			{150, 170, 190, 225, 275, 155};
	const unsigned int ShyguyTower::towerDamage[NUMBER_OF_LEVELS] =			{26, 45, 75, 120, 160, 190};
	const unsigned int ShyguyTower::towerPrice[NUMBER_OF_LEVELS] =			{20, 40, 85, 120, 155, 190};
	const unsigned int ShyguyTower::towerValue[NUMBER_OF_LEVELS] =			{10, 17, 30, 60, 80, 110};
	const string ShyguyTower::towerName = "Torre Shyguy";


	const ShyguyTower * ShyguyTower::m_pStaticReference = NULL;
	shared_ptr<SDLSound> ShyguyTower::m_pHittedSound = shared_ptr<SDLSound>();
	shared_ptr<SDLSound> ShyguyTower::m_pLaunchSound = shared_ptr<SDLSound>();

	/************************************************************************/
	/* Protected functions                                                  */
	/************************************************************************/
	void ShyguyTower::initBaseValues() {
		for(unsigned int i = 0; i < NUMBER_OF_LEVELS; i++) {
			m_shootingInterval[i] = shootingInterval[i];
			m_towerDamage[i] = towerDamage[i];
			m_towerRange[i] = towerRadius[i];
			m_towerPrice[i] = towerPrice[i];
			m_towerValue[i] = towerValue[i];
		}
		m_towerName = towerName;

		m_pDescriptionTile = new Tile(Coord2D(0.81191*screenWidth, 0.375*screenHeight), Coord2D(184, 74), 
			imgTile, TD_Resources::ResourceManager::loadImage("GUI/Descriptions/shyguyTowerDescription.png", Color::PINK));
		m_baseTowerType = shyguyTower_lvl1;
		m_baseShotType = pelletShot_lvl1;
		//Upgrade bar displacement
		m_upBarDisplacement = Coord2D(-15, 50);
	}

	/************************************************************************/
	/* ctors and dtors                                                      */
	/************************************************************************/
	
	ShyguyTower::ShyguyTower() {
		initBaseValues();
	}

	ShyguyTower::ShyguyTower(const ShyguyTower & rhs) {
		
	}

	ShyguyTower & ShyguyTower::operator=(const ShyguyTower &rhs) {
		BaseTower::operator=(rhs);
		return(*this);
	}

	ShyguyTower::ShyguyTower(unsigned int g_ID, const Coord2D & turretPosition) : BaseTower (g_ID, turretPosition) {
		
		initBaseValues();

		m_pAnimationSet = AnimationSetFactory::createTowerAnimationSet(m_baseTowerType, "Idle");
		m_pBaseShotAS = AnimationSetFactory::createShotAnimationSet(m_baseShotType, "Moving");

		m_shapes.push_back(new RectangleShape(turretPosition - m_pAnimationSet->getSprites()->getTilesize()/2, m_pAnimationSet->getSprites()->getTilesize()));
	}

	ShyguyTower::~ShyguyTower() {

	}
}